<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>await表达式的执行顺序</title>
</head>

<body>
    <!--
        结论：如果有同步代码和异步代码同时出现，一定是先执行同步，在执行异步
    -->
    <script>
        async function main() {
            console.log(1111);
            let result = await Promise.resolve('ok');
            console.log(result);
            console.log(2222);
            console.log(3333);
            console.log(4444);
            let result1 = await Promise.resolve('okk');
            console.log(result1);
            console.log(6666);
            console.log(7777);
        }
        //调用
        main();
        console.log(5555);
    </script>
</body>

</html>